<template>
  <div class="task-date-picker">
    <cproPublic title="任务周期" :show-stat="true">
      <template v-slot="content">
        <my-date-picker :dateTime="dateTime" @getPickedDate="getPickedDate"></my-date-picker>
      </template>
    </cproPublic>
  </div>
</template>

<script lang="ts" setup >
import myDatePicker from '@/components/my-date-picker/my-date-picker.vue'
import cproPublic from '@/components/creat-projects/cpro-public.vue'
import { ElMessage } from 'element-plus'
import moment from 'moment'
import { ref } from 'vue'
const emit = defineEmits(['getTimeDate'])
const dateTime = ref([])
const getPickedDate = (v) => {
  dateTime.value = v
  const createDate = moment(v[0]).format('YYYY-MM-DD')
  const finishDate = moment(v[1]).format('YYYY-MM-DD')
  emit('getTimeDate', createDate, finishDate)
}
const valDate =():Boolean=>{
  if(!dateTime.value[0]){
    ElMessage({
    showClose: true,
    message: '请选择项目周期！',
    type: 'error',
  })
     return false
  }
  return true
}
defineExpose({valDate})
</script>
<style scoped></style>
